<!--  -->
<template>
  <div class="maincon">
    <el-row :gutter="15">
      <el-col :md="24" :lg="6" :xl="6" class="reals">
        <el-card shadow="hover">
          <div class="realstop">
            <div class="r-t-left">
              <div class="leftcon">
                <i
                  class="
                    iconfont
                    icon-dingdandingdanmingxishouzhimingxi
                    iconstyle
                  "
                ></i>
              </div>
            </div>
            <div class="r-t-right">
              <span>订单数</span>
              <span>84</span>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :md="24" :lg="6" :xl="6" class="reals">
        <el-card shadow="hover">
          <div class="realstop">
            <div class="r-t-left">
              <div class="leftcon">
                <i class="iconfont icon-yonghu iconstyle"></i>
              </div>
            </div>
            <div class="r-t-right">
              <span>投稿数</span>
              <span>84</span>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :md="24" :lg="6" :xl="6" class="reals">
        <el-card shadow="hover">
          <div class="realstop">
            <div class="r-t-left">
              <div class="leftcon">
                <i class="iconfont icon-huiyuan iconstyle"></i>
              </div>
            </div>
            <div class="r-t-right">
              <span>会员数</span>
              <span>84</span>
            </div>
          </div>
        </el-card>
      </el-col>

      <el-col :md="24" :lg="6" :xl="6" class="reals">
        <el-card shadow="hover">
          <div class="realstop">
            <div class="r-t-left">
              <div class="leftcon">
                <i class="iconfont icon-duosucai iconstyle"></i>
              </div>
            </div>
            <div class="r-t-right">
              <span>素材数</span>
              <span>84</span>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <!-- table -->
    <el-card shadow="hover" class="treetable">
      <el-table
        v-loading="loading"
        element-loading-text="耗尽脑汁加载中"
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{ textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }"
      >
        <el-table-column type="expand" width="20px">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-form-item label="商品名称">
                <span>{{ props.row.name }}</span>
              </el-form-item>
              <el-form-item label="所属店铺">
                <span>{{ props.row.shop }}</span>
              </el-form-item>
              <el-form-item label="商品 ID">
                <span>{{ props.row.id }}</span>
              </el-form-item>
              <el-form-item label="店铺 ID">
                <span>{{ props.row.shopId }}</span>
              </el-form-item>
              <el-form-item label="商品分类">
                <span>{{ props.row.category }}</span>
              </el-form-item>
              <el-form-item label="店铺地址">
                <span>{{ props.row.address }}</span>
              </el-form-item>
              <el-form-item label="商品描述">
                <span>{{ props.row.desc }}</span>
              </el-form-item>
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="分类ID" prop="id" width="100px">
        </el-table-column>
        <el-table-column label="分类名称" prop="name"> </el-table-column>
        <el-table-column label="所属分类" prop="desc"> </el-table-column>
        <el-table-column label="备注" prop="desc"> </el-table-column>
        <el-table-column fixed="right" label="操作">
          <template slot-scope="scope">
            <el-button
              @click="handleEdit(scope.$index, scope.row)"
              type="text"
              size="small"
              icon="el-icon-edit"
            >
              编辑
            </el-button>
            <el-button
              @click.native.prevent="deleteRow(scope.$index, tableData)"
              type="text"
              size="small"
              icon="el-icon-delete"
              style="color: red"
            >
              删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagecount">
        <Pagination v-bind:child-msg="pageparm" @callFather="callFather" />
      </div>
    </el-card>
  </div>
</template>

<script>
import { tabData } from "@/views/Article/mock";
export default {
  data() {
    return {
      loading: false, //是显示加载
      tableData: [],
      // 分页参数
      pageparm: {
        currentPage: 1,
        pageSize: 10,
        total: 10,
      },
    };
  },

  methods: {
    // 获取列表
    getlist() {
      this.loading = true;
      this.tableData = tabData.tablelist;
      // this.pageparm.currentPage = this.formInline.page;
      // this.pageparm.pageSize = this.formInline.size;
      // this.pageparm.total = tabData.count;
      this.loading = false;
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.page = parm.currentPage;
      this.formInline.size = parm.pageSize;
      console.log(parm);
    },
  },
  created() {
    this.getlist();
  },
};
</script>
<style lang='scss' scoped>
.reals {
  padding: 10px 0;
  &:nth-child(2) {
    .realstop {
      .r-t-left {
        .leftcon {
          background-color: #fdc103;
        }
      }
    }
  }
  &:nth-child(3) {
    .realstop {
      .r-t-left {
        .leftcon {
          background-color: #36b206;
        }
      }
    }
  }
  &:nth-child(4) {
    .realstop {
      .r-t-left {
        .leftcon {
          background-color: #ec119a;
        }
      }
    }
  }
  .realstop {
    display: flex;
    align-items: center;
    .r-t-left {
      flex: 5;
      display: flex;
      justify-content: center;
      .leftcon {
        display: inline-block;
        background-color: #03b4fd;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        line-height: 60px;
        text-align: center;
        .iconstyle {
          color: #ffffff;
          font-size: 20px;
        }
      }
    }
    .r-t-right {
      flex: 5;
      display: flex;
      flex-direction: column;
      span {
        color: #333;

        &:first-child {
          font-size: 14px;
          margin-bottom: 10px;
        }
        &:last-child {
          font-size: 18px;
        }
      }
    }
  }
}

.treetable {
  margin-top: 20px;
  height: calc(90% - 20px);
  overflow-y: auto;
//   padding-bottom: 50px;
  .pagecount {
    // width: 100%;
    // position: absolute;
    // bottom: 10px;
    // margin-top: 30px;
    // bottom: 16px;
    // background: #fff;
    // z-index: 6;
    // .page-box {
    //   margin: 10px auto;
    //   position: absolute;
    //   bottom: 10px;
    //   right: 72px;
    // }
  }
}
</style>